#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm>

#define FOR(i,a,n) for(int i=a;i<n;++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

bool isUpperCase[110];
bool needChange[110];
string s[110];
string sw;
char c[2];

inline bool isUpper(char c)
{
    if(c>='A'&&c<='Z') return true;
    return false;
}
int main()
{
    int n;
    while(cin>>n)
    {
        fill(isUpperCase,isUpperCase+110,false);
        fill(needChange,needChange+110,false);
        REP(i,n)
        {
            cin>>s[i];
            REP(j,s[i].size()) if(isUpper(s[i][j])) s[i][j]+=32;
        }
        cin>>sw>>c;
        REP(i,sw.size()) if(isUpper(sw[i])) isUpperCase[i] = true,sw[i]+=32;
        REP(i,n) REP(j,sw.size())
        {
            int pos;
            if((pos=sw.find(s[i],j))==string::npos) break;
            FOR(k,pos,pos+s[i].size()) needChange[k] = true;
        }
        REP(i,sw.size()) if(needChange[i])
        {
            if(sw[i]==c[0])
            {
                if(c[0]=='a') sw[i]='b';
                else sw[i]='a';
            }
            else sw[i]=c[0];
        }
        REP(i,sw.size())
        {
            putchar(isUpperCase[i]?sw[i]-32:sw[i]);
        }
        cout<<endl;
    }
	return 0;
}
